using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Beta_fundies_masterpages_fundies : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            SetBackground();
        }

    }

    private void SetBackground()
    {
        DateTime date;
        DAL.ArchiveBackground myBG = null;
        if (Helpers.QueryStringHelper.TryGetDateTime("date", out date))
        {
            myBG = DAL.ArchiveBackgrounds.GetByDateTime(date);
        }
        else
        {
            myBG = DAL.ArchiveBackgrounds.GetLatestBackground();
        }

        if (myBG != null)
        {
            htmlBody.Style.Add("background-color", myBG.Color);
        }
        else
        {
            htmlBody.Style.Add("background-color", "#3399FF");
        }
    }
}
